﻿using EPiServer;
using EPiServer.DynamicContent;

namespace SocialPack.modules.SocialPack.DynamicContent.Facebook
{
    [DynamicContentPlugIn(
        DisplayName = "Facebook Recommendations",
        Description = "Displays Facebook Recommendations",
        ViewUrl = "~/modules/socialpack/dynamiccontent/facebook/recommendations.ascx")]
    public partial class Recommendations : UserControlBase
    {
        public string CountryCode { get; set; }

        public new string Site { get; set; }

        public int Width { get; set; }

        public int Height { get; set; }

        public bool ShowHeader { get; set; }

        public int MaxAge { get; set; }

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!string.IsNullOrWhiteSpace(this.CountryCode))
            {
                this.RecommendationsControl.CountryCode = this.CountryCode;
            }

            if (!string.IsNullOrWhiteSpace(this.Site))
            {
                this.RecommendationsControl.Site = this.Site;
            }

            this.RecommendationsControl.Width = this.Width;
            this.RecommendationsControl.Height = this.Height;
            this.RecommendationsControl.ShowHeader = this.ShowHeader;
            this.RecommendationsControl.MaxAge = this.MaxAge;
        }
    }
}